package cn.gemiman.daoyi.module.iot.dal.mysql.kafkamsglogs;

import cn.gemiman.daoyi.framework.common.pojo.PageResult;
import cn.gemiman.daoyi.framework.mybatis.core.mapper.BaseMapperX;
import cn.gemiman.daoyi.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.gemiman.daoyi.module.iot.controller.admin.kafkamsglogs.vo.KafkaMsgLogsPageReqVO;
import cn.gemiman.daoyi.module.iot.dal.dataobject.kafkamsglogs.KafkaMsgLogsDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * kafka原始消息 Mapper
 *
 * @author 道一源码
 */
@Mapper
public interface KafkaMsgLogsMapper extends BaseMapperX<KafkaMsgLogsDO> {

    default PageResult<KafkaMsgLogsDO> selectPage(KafkaMsgLogsPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<KafkaMsgLogsDO>()
                .likeIfPresent(KafkaMsgLogsDO::getTopics, reqVO.getTopics())
                .likeIfPresent(KafkaMsgLogsDO::getBootstrapServers, reqVO.getBootstrapServers())
                .likeIfPresent(KafkaMsgLogsDO::getConsumerGroupId, reqVO.getConsumerGroupId())
                .eqIfPresent(KafkaMsgLogsDO::getViewed, reqVO.getViewed())
                .betweenIfPresent(KafkaMsgLogsDO::getCreateTime, reqVO.getCreateTime())
                .betweenIfPresent(KafkaMsgLogsDO::getUpdateTime, reqVO.getUpdateTime())
                .orderByDesc(KafkaMsgLogsDO::getId));
    }

}
